package com.yonyou.pmclouds.basecom.bp.processor;

import com.yonyou.pmclouds.basecom.entity.SuperVO;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.basecom.util.BeanHelper;
import com.yonyou.pmclouds.basecom.util.CommonFieldConst;
import com.yonyou.pmclouds.task.rmiitf.TaskRemoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MobileTaskFinishProcessor<T extends SuperVO> implements SingleProcessor<T>{

	@Autowired
	private TaskRemoteService taskService;
	
	@Override
	public void process(T vo, T orig) throws BusinessException {
        String pkBill = (String) BeanHelper.getProperty(vo, vo.pkFiledName());
        String pk_receiver = (String) BeanHelper.getProperty(vo, vo.taskReceiverField());
        byte billStatus = (byte) BeanHelper.getProperty(vo, CommonFieldConst.BILLSTATUS);

        // 完成任务，更新记录
        taskService.finishTask(pkBill, pk_receiver, billStatus);
	}

}
